package jp.co.piratealliance.pirateAllianceWeb.web.action.search;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.struts2.ServletActionContext;

import jp.co.piratealliance.pirateAllianceWeb.common.base.BaseAction;
import jp.co.piratealliance.pirateAllianceWeb.dto.search.SearchInfoDto;
import jp.co.piratealliance.pirateAllianceWeb.dto.task.TaskFeeDetailInfoDto;
import jp.co.piratealliance.pirateAllianceWeb.service.search.SearchService;


/**
 * copyright pirate alliance team 2014 检索
 *
 * @author panxuejuan
 */

public class SearchManagerWebAction extends BaseAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private SearchService searchService;
	
	private List<SearchInfoDto> searchList;
	
	private String orderId;

	//检索页面初期化
	public String searchManagerInit()
	{
		//资源分类Id:
//		String resourceTypeId = "1";
		String resourceTypeId = ServletActionContext.getRequest().getParameter("resourceTypeId");
		String orderIdPara = ServletActionContext.getRequest().getParameter("orderId");
		String areaId = ServletActionContext.getRequest().getParameter("areaId");
		orderId=orderIdPara;
		Map<String,String> mapParameter =new HashMap<String,String>();
		mapParameter.put("resource_type_id", resourceTypeId);
		mapParameter.put("area_id", areaId);
		searchList = searchService.getSearchListByResourceTypeId(mapParameter);
		return SUCCESS;
	}

	//选择资源，更新商品受注明细
	public String updateGoodsDetail()
	{
		String goodsId= ServletActionContext.getRequest().getParameter("goodsId");
//		String orderId ="2014082000000005";
		String orderId = ServletActionContext.getRequest().getParameter("orderId");
		String price=ServletActionContext.getRequest().getParameter("price");
		TaskFeeDetailInfoDto taskFeeDetailInfo=new TaskFeeDetailInfoDto();
		taskFeeDetailInfo.setGoods_id(goodsId);
		taskFeeDetailInfo.setOrder_id(orderId);
		taskFeeDetailInfo.setPrice(Float.parseFloat(price));
		this.searchService.updateGoodsDetailInfo(taskFeeDetailInfo);
		return SUCCESS;
	}

	
	public SearchService getSearchService() {
		return searchService;
	}


	public void setSearchService(SearchService searchService) {
		this.searchService = searchService;
	}


	public List<SearchInfoDto> getSearchList() {
		return searchList;
	}


	public void setSearchList(List<SearchInfoDto> searchList) {
		this.searchList = searchList;
	}

	public String getOrderId() {
		return orderId;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}


	
}
